package com.medata.service.impl;

import com.medata.dataObject.LogMakeDocument;
import com.medata.repository.LogMakeDocumentRepository;
import com.medata.service.LogMakeDocumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.sql.Timestamp;

/**
 * @author ：zb
 * @date ：Created in 2019/5/28 0028 10:58
 * @description：
 */
@Service
public class LogMakeDocumentServiceImpl implements LogMakeDocumentService {
    @Autowired
    private LogMakeDocumentRepository logMakeDocumentRepository;

    @Override
    public void saveOrUpdate(LogMakeDocument logMakeDocument) {
        logMakeDocumentRepository.save(logMakeDocument);
    }

    @Override
    @Transactional
    public void deleteByLogtimeBetweenAndActionid(Timestamp startTime, Timestamp endTime, Integer id) {
        logMakeDocumentRepository.deleteByLogtimeBetweenAndActionid(startTime,endTime,id);
    }

    @Override
    public Page<LogMakeDocument> findByLogtimeBetweenAndActionidOrderByLogtimeDesc(Timestamp startTime, Timestamp endTime, Integer id, Pageable pageable) {
        return logMakeDocumentRepository.findByLogtimeBetweenAndActionidOrderByLogtimeDesc(startTime,endTime,id,pageable);
    }
}
